package cn.monkey.rivergrab;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.SimpleAdapter;

public class RiverCrab extends Activity {
    /** Called when the activity is first created. */
	private int[] icon = new int[]{
			R.drawable.ic_launcher,
			R.drawable.ic_launcher,
			R.drawable.ic_launcher,
			R.drawable.ic_launcher,
			R.drawable.ic_launcher,
			R.drawable.ic_launcher,
	};
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        GridView mMainView = (GridView)findViewById(R.id.main_view);
        ArrayList<HashMap<String, Object>> list  =  new ArrayList<HashMap<String,Object>>();
        for(int i =0;i<icon.length;i++){
        	HashMap<String, Object> map = new HashMap<String, Object>();  
        	map.put("icon", icon[i]);
        	list.add(map);
        }
        mMainView.setAdapter(new SimpleAdapter(this,list,R.layout.gridview_item,new String[] {"icon"},new int[] {R.id.icon}));
        mMainView.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				switch(position){
					case 0:
						Intent i = new Intent();
						i.setClass(RiverCrab.this, PreviewImage.class);
						startActivity(i);
						break;
					case 1:
						break;
					case 2:
						break;
					case 3:
						break;
					case 4:
						break;
					case 5:
						break;
				}
			}
		});
    }
    
}